//
//  DetaildTableViewCell.m
//  片刻
//
//  Created by lanou3g on 15/6/6.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "DetaildTableViewCell.h"
#import "MaocHeader.h"
#import <UIImageView+WebCache.h>
@implementation DetaildTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

-(void)dealloc
{
    _titilLael = nil;
    _contentLabel = nil;
    _image = nil;
    _model = nil;
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titilLael = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, 150/2-20)];
        _titilLael.font =[UIFont systemFontOfSize:20];
        _titilLael.numberOfLines = 0;
        [self.contentView addSubview:_titilLael];
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, 150/2, SCREEN_WIDTH/2-10, 150/2+5)];
        _contentLabel.numberOfLines = 0;
        _contentLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_contentLabel];
        _image = [[UIImageView alloc] initWithFrame:CGRectMake(10, 150/2, SCREEN_WIDTH/2-15, 150/2+5)];
        [self.contentView addSubview:_image];
        
        [_titilLael release];
        [_contentLabel release];
        [_image release];
    }
    return self;
}

-(void)setModel:(ReadModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
        _titilLael.text = model.title;
         _contentLabel.text = model.content;
        [_image sd_setImageWithURL:[NSURL URLWithString:model.coverimg]];
        
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
